#include<bits/stdc++.h>
using namespace std;
bool zs(int a){
	if(a == 1){
		return false;
	}
	for(int i = 2 ; i <= sqrt(a) ; i++){
		if(a % i == 0){
			return false;
			break;
		}
	}
	return true;
}
int main(){
	freopen("primes.in" , "r" , stdin);
	freopen("primes.out" , "w" , stdout);
	int m , n , count = 0;
	cin >> m >> n;
	for(int i = m ; i <= n ; i++){
		if(zs(i) == false){
			continue;
		}
		count = count + 1;
	}
	cout << count << endl;
	return 0;
}